package com.bdqn.util;

import java.util.List;

/**
 * Page类
 *
 */
public class Page<T> {
    private int totalPageCount;//总页数
    private int pageSize = 5;//每页显示的数量
    private int totalCount=0;//记录总数
    private int currentPageNo=1;//页码
    private List<T> list;//每页显示的数据集合

    public int getTotalPageCount() {
        return totalPageCount;
    }

    public void setTotalPageCount(int totalPageCount) {
        this.totalPageCount = totalPageCount;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize<=0?1:pageSize;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        if(totalCount>0){
            this.totalCount = totalCount;
            this.totalPageCount = this.totalCount % this.pageSize  == 0 ?(this.totalCount / this.pageSize ):(this.totalCount / this.pageSize +1 );
        }
    }

    public int getCurrentPageNo() {
        return currentPageNo;
    }

    public void setCurrentPageNo(int currentPageNo) {
        this.currentPageNo = currentPageNo <= 0 ?(this.currentPageNo = 1):(currentPageNo > this.totalPageCount?this.totalPageCount: currentPageNo);
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

}
